NIELIT O Level Exam

Write a list comprehension for number and its cube for l=[1, 2, 3, 4, 5, 6, 7, 8, 9].

Write a list comprehension for number and its cube for l=[1, 2, 3, 4, 5, 6, 7, 8, 9].

नंबर के लिए एक लिस्ट लिखें और उसके घन के लिए l = [1, 2, 3, 4, 5, 6, 7, 8, 9]

A. [x**3 for x in l]

B. [x^3 for x in l]

C. [x**3 in l]

D. [x^3 in l]




Correct Answer is :

A. [x**3 for x in l]



Explanation
The list comprehension to print a list of cube of the numbers for the given list is: [x**3 for x in l].
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad